﻿<navigation:Page x:Class="LEEAAttendanceControl.Views.ExceptionAssignments" 
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"  
               xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:my="clr-namespace:LEEAAttendanceControl.Web.Services"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="New Exception Assignments">
    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <LinearGradientBrush x:Key="BackRectangleBrush" EndPoint=".7,1" StartPoint=".7,0">
                <GradientStop Color="#FCFFFFFF" Offset="0.015"/>
                <GradientStop Color="#F7FFFFFF" Offset="0.375"/>
                <GradientStop Color="#E5FFFFFF" Offset="0.6"/>
                <GradientStop Color="#D1FFFFFF" Offset="1"/>
            </LinearGradientBrush>

            <Style x:Key="DataGridHeaderStyle" TargetType="sdk:DataGridColumnHeader">
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid x:Name="RootGrid">
                                <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                <Rectangle Stretch="Fill">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
                                            <GradientStop Color="#FCFFFFFF" Offset="0.015"/>
                                            <GradientStop Color="#F7FFFFFF" Offset="0.375"/>
                                            <GradientStop Color="#E5FFFFFF" Offset="0.6"/>
                                            <GradientStop Color="#D1FFFFFF" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>

                                <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch" Width="1" HorizontalAlignment="Right"/>

                                <CheckBox x:Name="SelectAllCheckBox" Click="SelectAllCheckBox_Click" Margin="2,0,0,0"
                                          VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="265"/>
                    <RowDefinition Height="200"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <Grid Background="#404041" Grid.Row="0">
                    <TextBlock Text="New Exception Assignments" FontSize="14" FontWeight="Bold" Foreground="White"
                               Margin="5,3,3,2" HorizontalAlignment="Left"/>
                </Grid>

                <StackPanel Orientation="Vertical" Grid.Row="2">

                    <sdk:DataGrid x:Name="EmployeesGrid" AutoGenerateColumns="False" MaxHeight="260">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTemplateColumn Header="First Name" CanUserReorder="False" CanUserResize="True"
                                                        Width="230" IsReadOnly="True">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding FirstName}" HorizontalAlignment="Left" Margin="5,0,0,0"
                                               VerticalAlignment="Center" Height="25"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Last Name" CanUserReorder="False" CanUserResize="True"
                                                        Width="230" IsReadOnly="True">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding LastName}" HorizontalAlignment="Left" Margin="5,0,0,0"
                                               VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Header="Department" CanUserReorder="False" CanUserResize="True"
                                                        Width="203" IsReadOnly="True">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding Department}" HorizontalAlignment="Left" Margin="5,0,0,0"
                                               VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Width="103" HeaderStyle="{StaticResource DataGridHeaderStyle}"
                                                    CanUserReorder="False" CanUserResize="False">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox x:Name="EmployeeCheck" IsChecked="{Binding IsChecked, Mode=TwoWay}"
                                                  HorizontalAlignment="Center" IsThreeState="False"
                                                  VerticalAlignment="Center" Click="EmployeeCheck_Click"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </StackPanel>

                <StackPanel Orientation="Vertical" Grid.Row="3" Margin="0,15,0,0">
                    <Grid Background="#404041">
                        <TextBlock Text="Exceptions" Foreground="White" FontSize="13" FontWeight="Bold" Margin="5,2,2,2"
                                   HorizontalAlignment="Left"/>
                    </Grid>
                    <riaControls:DomainDataSource x:Name="ExceptionsDataSource" AutoLoad="True" LoadSize="10"
                                                  QueryName="GetExeptions">
                        <riaControls:DomainDataSource.DomainContext>
                            <my:LEEAContext />
                        </riaControls:DomainDataSource.DomainContext>
                    </riaControls:DomainDataSource>

                    <sdk:DataGrid x:Name="ExceptionsGrid" AutoGenerateColumns="False" MaxHeight="180"
                                  ItemsSource="{Binding Data, ElementName=ExceptionsDataSource}">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTemplateColumn Header="Exceptions" Width="203" IsReadOnly="True">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:Label Content="{Binding Name}" HorizontalAlignment="Left" Margin="5,0,0,0"
                                                   VerticalAlignment="Center" Height="25"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Width="220" CanUserReorder="False" CanUserResize="False">
                                <sdk:DataGridTemplateColumn.HeaderStyle>
                                    <Style TargetType="sdk:DataGridColumnHeader">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate>
                                                    <Grid>
                                                        <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                        <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                        <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                        <TextBlock Text="From" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </sdk:DataGridTemplateColumn.HeaderStyle>
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <sdk:DatePicker Width="150" VerticalAlignment="Center" Margin="3"
                                                        HorizontalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Width="210" CanUserReorder="False" CanUserResize="False">
                                <sdk:DataGridTemplateColumn.HeaderStyle>
                                    <Style TargetType="sdk:DataGridColumnHeader">
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate>
                                                    <Grid>
                                                        <Rectangle Fill="#FF1F3B53" Stretch="Fill"/>

                                                        <Rectangle Stretch="Fill" Fill="{StaticResource BackRectangleBrush}"/>

                                                        <Rectangle Fill="#FFC9CACA" VerticalAlignment="Stretch"
                                                                   Width="1" HorizontalAlignment="Right"/>

                                                        <TextBlock Text="Duration" HorizontalAlignment="Center"
                                                                   VerticalAlignment="Center"/>
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </sdk:DataGridTemplateColumn.HeaderStyle>
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <toolkit:NumericUpDown Width="120" DecimalPlaces="0" Value="1" Margin="3"
                                                               Background="White" HorizontalContentAlignment="Left"
                                                               VerticalContentAlignment="Center" Maximum="31" Minimum="1"
                                                               HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                            <sdk:DataGridTemplateColumn Width="150" CanUserReorder="False" CanUserResize="False">
                                <sdk:DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button x:Name="ClearButton" Content="Clear" Margin="3" HorizontalAlignment="Center"
                                                VerticalAlignment="Center" Click="ClearButton_Click"/>
                                    </DataTemplate>
                                </sdk:DataGridTemplateColumn.CellTemplate>
                            </sdk:DataGridTemplateColumn>
                        </sdk:DataGrid.Columns>
                    </sdk:DataGrid>
                </StackPanel>

                <Grid Grid.Row="4">
                    <Button x:Name="ApplyButton" Content="Apply" Height="25" Width="65" Margin="0,10,0,0"
                            HorizontalAlignment="Center" Click="ApplyButton_Click"/>
                </Grid>
            </Grid>
        </ScrollViewer>
    </Grid>
</navigation:Page>
